/**
 * Created by kangli on 2018/3/7.
 */
$(function(){
    $("textarea").on("keyup",function(){
        console.log($(this).val());
        $(".at-jianKey").html($(this).val());
    })
})
/*选项上移*/
function moveup(btn){
    var obj = $(btn).parent().parent().parent(".optionsDiv");
    var currentId = $(btn).parent().parent().parent(".optionsDiv").attr("data-id");
    if(currentId > 1){
        obj.prev().before(obj); //上移动
        obj.attr("data-id",parseInt(currentId)-1);
        obj.next().attr("data-id",parseInt(currentId));
    }else {
       layer.msg("第一个选项不能上移了！")
    }
}
/*选项下移*/
function movedown(btn){
    var obj = $(btn).parent().parent().parent(".optionsDiv");
    var currentId = $(btn).parent().parent().parent(".optionsDiv").attr("data-id");
    if(currentId < 4){
        obj.next().after(obj); //下移动
        obj.attr("data-id",parseInt(currentId)+1);
        obj.prev().attr("data-id",parseInt(currentId));

    }else {
        layer.msg("最后一个选项不能下移了！")
    }
}